package com.orange.psx;

public class Order {

    private int number;
    private String item;
    private boolean isFilled = false;

    public Order(String item, int number) {
        this.item = item;
        this.number = number;
    }

    public Order fill(Warehouse warehouse) {
        int currentNumber = warehouse.getInventory(item);
        if (currentNumber >= number) {
            warehouse.add(item, -number);
            isFilled = true;
        }
        return this;
    }

    public boolean isFilled() {
        return isFilled ;
    }

}
